#pragma once
#include <BWAPI.h>
#include <BWTA.h>
#include <windows.h>
#include "CFormation.h"
#include "AI_Commands.h"

static bool analyzed;
static bool analysis_just_finished;
static BWTA::Region* home;
static BWTA::Region* enemy_base;
DWORD WINAPI AnalyzeThread();

class ExampleAIModule : public BWAPI::AIModule
{
public:
        virtual void onStart();
        virtual void onEnd(bool isWinner);
        virtual void onFrame();
        virtual bool onSendText(std::string text);
        virtual void onPlayerLeft(BWAPI::Player* player);
        virtual void onNukeDetect(BWAPI::Position target);
        virtual void onUnitCreate(BWAPI::Unit* unit);
        virtual void onUnitDestroy(BWAPI::Unit* unit);
        virtual void onUnitMorph(BWAPI::Unit* unit);
        virtual void onUnitShow(BWAPI::Unit* unit);
        virtual void onUnitHide(BWAPI::Unit* unit);
        virtual void onUnitRenegade(BWAPI::Unit* unit);

        bool aiCommands(std::string text);
        bool uiCommands(std::string text);
        bool formationCommands(std::string text);

        void drawStats();
        void showPlayers();
        void showForces();
		void drawProgressBar(BWAPI::Position pos, double progressFraction, BWAPI::Color innerBar) const;

        //Drawing flags
        bool show_stats;
        bool show_visibility_data;
        bool show_attack_lines;
        bool show_move_paths;
        bool show_formations;
        bool show_idle;
		bool show_enemy_sight_range;
		bool show_enemy_attack_range;

        //AI flags
        bool auto_gather;
};

	
